home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 67 / IOPROG_67A.ISO / soft / Tools / mwsppv4.exe / INSERT SWITCH.SCRIPT < prev    next >
Encoding:
Text File  |  1998-02-13  |  955 b   |  41 lines

  1. !!Script
  2. // Copyright ⌐ 1997-1998 - Modelworks Software
  3.  
  4. /**
  5. @Tool: insert Switch~inserts the Switch node. The Switch grouping node 
  6. traverses zero or one of the nodes specified in the choice field. 
  7. @EndTool: 
  8. @Summary: insert Switch~inserts the Switch node
  9. */
  10.  
  11. var Node = 
  12. "Switch {" +
  13. "\n\twhichChoice -1         # exposedField    SFInt32" + 
  14. "\n\tchoice                 # exposedField    MFNode" + 
  15. "\n\t[" +
  16. "\n\t\t@Caret" +
  17. "\n\t]" +
  18. "\n}" +
  19. "\n";
  20.  
  21. function DoCommand()
  22. {
  23.   var textUtilities = getScriptObject("Library\\textUtilities.script");
  24.   if (textUtilities)
  25.   {
  26.     var editor = getActiveEditor();
  27.     if (editor)
  28.     {
  29.       var lineIndex = textUtilities.InsertString(editor, Node);
  30.       
  31.       // Now replace @Caret with the real caret
  32.       var range = editor.findFirst("@Caret", lineIndex, 0);
  33.       editor.replace("", range);
  34.       editor.setActive("Insert Switch Node");
  35.     }
  36.   }
  37. }
  38.  
  39. !!/Script
  40.  
  41.